package org.example.zrccddllljh.Controlelr;

import org.apache.ibatis.annotations.Delete;
import org.example.zrccddllljh.Pojo.Doctor;
import org.example.zrccddllljh.Pojo.Result;
import org.example.zrccddllljh.Pojo.Nurse;
import org.example.zrccddllljh.Service.NurseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/nurse")
public class NurseController {
    @Autowired
    private NurseService nurseService;
    @GetMapping("/all")
    public Result<List<Nurse>> list(){
      List<Nurse> ls=  nurseService.list();
      return Result.success(ls);
    }

    @PostMapping("/add")
    public  Result add( @RequestBody Nurse nurse){
        nurseService.add(nurse);
        return Result.success();

    }
    @PutMapping
    public  Result updata(@RequestBody Nurse nurse){
        nurseService.updata(nurse);
        return  Result.success();
    }
     @DeleteMapping

     public Result delete(Integer id){
         nurseService.deleteById(id);
         return Result.success();
     }


    @GetMapping
    public Result<List<Nurse>> list(
            @RequestParam(required = false) int pageNow,
            @RequestParam(required = false) int pageSize

    ) {
        List<Nurse> pb= nurseService.aaa(pageNow,pageSize);

        return Result.success(pb);
    }

}
